package mbms.mobilebudget.entity;

import java.io.Serializable;
import java.util.Date;

import mbms.mobilebudget.entity.EnumValues.CurrencyType;
import mbms.mobilebudget.entity.EnumValues.IncomeCategoryEnum;

import com.j256.ormlite.field.DataType;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

@DatabaseTable(tableName="income")
public class Income implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 188486879616720377L;

	@DatabaseField(generatedId = true)
	private Integer id;
	
	@DatabaseField
	private CurrencyType currencyType;
	
	@DatabaseField(canBeNull = false)
	private Double amount;
	
	@DatabaseField(canBeNull = false)
	private IncomeCategoryEnum incomeCategory;
	
	@DatabaseField(canBeNull = false, dataType=DataType.DATE)	
	private Date dateOfIncome;
	
	@DatabaseField(canBeNull = true)
	private String incomeExplanation;
	
	@DatabaseField(foreign=true)
	private BankAccount bankAccount;

	@DatabaseField(foreign = true)
	private CreditCard creditCard;
	
	public Income() {
	}
	
	public Income(Integer id, CurrencyType currencyType, Double amount,
			IncomeCategoryEnum incomeCategory, Date dateOfIncome,
			String incomeExplanation, BankAccount bankAccount,
			CreditCard creditCard) {
		super();
		this.id = id;
		this.currencyType = currencyType;
		this.amount = amount;
		this.incomeCategory = incomeCategory;
		this.dateOfIncome = dateOfIncome;
		this.incomeExplanation = incomeExplanation;
		this.bankAccount = bankAccount;
		this.creditCard = creditCard;
	}

	public CurrencyType getCurrencyType() {
		return currencyType;
	}
	public void setCurrencyType(CurrencyType currencyType) {
		this.currencyType = currencyType;
	}
	public BankAccount getBankAccount() {
		return bankAccount;
	}
	public void setBankAccount(BankAccount bankAccount) {
		this.bankAccount = bankAccount;
	}
	public CreditCard getCreditCard() {
		return creditCard;
	}
	public void setCreditCard(CreditCard creditCard) {
		this.creditCard = creditCard;
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + id;
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Income other = (Income) obj;
		if (id != other.id)
			return false;
		return true;
	}
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public CurrencyType getAccountType() {
		return currencyType;
	}
	public void setAccountType(CurrencyType accountType) {
		this.currencyType = accountType;
	}
	public Double getAmount() {
		return amount;
	}
	public void setAmount(Double amount) {
		this.amount = amount;
	}
	public IncomeCategoryEnum getIncomeCategory() {
		return incomeCategory;
	}
	public void setIncomeCategory(IncomeCategoryEnum incomeCategory) {
		this.incomeCategory = incomeCategory;
	}
	public Date getDateOfIncome() {
		return dateOfIncome;
	}
	public void setDateOfIncome(Date dateOfIncome) {
		this.dateOfIncome = dateOfIncome;
	}
	public String getIncomeExplanation() {
		return incomeExplanation;
	}
	public void setIncomeExplanation(String incomeExplanation) {
		this.incomeExplanation = incomeExplanation;
	}
	
	
}
